import requests
import hashlib
import time
from urllib.parse import urlencode

id =  14041
while True:
    times = int(time.time() * 1000)


    json_data = {
        'pid': id,
        'qty': 1,
        'timestamp': times,
    }

    query_string = 'api/product/buy?' + urlencode(json_data) + '&key=6rnrdpjjv6wz2sspxqeibesov1itxddc'
    # print(query_string)
    lowstr = query_string.lower()

    sign = hashlib.md5(lowstr.encode()).hexdigest()

    headers = {
        'accept': '*/*',
        'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
        'cache-control': 'no-cache',
        'content-type': 'application/json;charset=UTF-8',
        'origin': 'https://h5.newbee.net.cn',
        'platformn': 'h5',
        'pragma': 'no-cache',
        'priority': 'u=1, i',
        'referer': 'https://h5.newbee.net.cn/',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-site',
        'signature': '2bd17b71495819c32b37b39388bcb2ac',
        'token': '1431f3a7-f1d1-417a-8d70-ac19d2d95ca7',
        'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
        'x-token': sign,
    }

    response = requests.post('https://api.newbee.net.cn/api/product/buy', headers=headers, json=json_data)
    print('id:::',id,response.text)
    id += 1



# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{"pid":14000,"qty":1,"timestamp":1741680950472}'
#response = requests.post('https://api.newbee.net.cn/api/product/buy', headers=headers, data=data)